package cn.baidu.Servlet;

import cn.baidu.pojo.Room;
import cn.baidu.service.service;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/houtai")
public class houtai extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("UTF-8");//设置返回数据的编码方式
        resp.setHeader("Content-type", "text/html; charset=utf-8");//设置返回数据的格式为json
        req.setCharacterEncoding("UTF-8");//设置接收参数的编码方式
        List<Room> room = new service().findRoom(-1, "", "");
        req.setAttribute("rooms",room);
        req.getRequestDispatcher("/houtai.jsp").forward(req,resp);
    }

}
